﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using SQLExecute;

/// <summary>
/// Summary description for ProfileAll
/// </summary>
public class ProfileAll
{
    public Guid _id;
    DataSet ds;
    private string _fullname;
    private DateTime _birth;
    private string _sex;
    private int _height;
    private int _weight;
    private string _married;
    private string _phone;
    private string _mail;

    private int _district_permanent_address;
    private string _permanent_address;
    private string _current_address;
    private string _idcard;
    private string _relocate;
    private string _aptitude;


    public ProfileAll()
    {
        
    }
    public Guid ID
    {
        set { _id = value; }
        get { return _id; }
    }

    public string ProfileType
    {
        set { _profile_type = value; }
        get { return _profile_type; }
    }
    public string PositionApply
    {

        set
        {
            _position_apply = value;
        }
        get { return _position_apply; }
    }
    public DateTime AvailableDate
    {
        set { _available_date = value; }
        get { return _available_date; }
    }
    public long ExpectedSalary
    {
        set { _expected_salary = value; }
        get { return _expected_salary.Value; }
    }
    public string CurrencySalary
    {
        set { _currency_salary = value; }
        get { return _currency_salary; }
    }
    private int _known_us_id;
    public int KnownUsFromID
    {
        set { _known_us_id = value; }
        get { return _known_us_id; }
    }
    private string _known_us;
    public string KnownUs
    {
        set { _known_us = value; }
        get { return _known_us; }
    }




    /*---------------------------- Personal--------------------*/

    public string Fullname
    {
        set { _fullname = value; }
        get { return _fullname; }
    }
    public DateTime Birth
    {
        set { _birth = value; }
        get { return _birth; }
    }
    public string Sex
    {
        set { _sex = value; }
        get { return _sex; }

    }
    public int Height
    {
        set { _height = value; }
        get { return _height; }
    }
    public int Weight
    {
        set { _weight = value; }
        get { return _weight; }
    }
    public string Phone
    {
        set { _phone = value; }
        get { return _phone; }
    }
    public string Mail
    {
        set { _mail = value; }
        get { return _mail; }
    }
    public string Married
    {
        set { _married = value; }
        get { return _married; }
    }

    private string _number_of_childrens;
    public string NumberOfChildrens
    {
        set { _number_of_childrens = value; }
        get { return _number_of_childrens; }
    }

    private string _others_martial_status;
    public string OthersMartialStatus
    {
        set { _others_martial_status = value; }
        get { return _others_martial_status; }
    }

    public string PermanentAddress
    {
        set { _permanent_address = value; }
        get { return _permanent_address; }
    }
    public int DistrictPermanentAddress
    {
        set { _district_permanent_address = value; }
        get { return _district_permanent_address; }
    }
    private int _district_current_address;
    public int DistrictCurrentAddress
    {
        set { _district_current_address = value; }
        get { return  _district_current_address; }
    }
    public string CurrentAddress
    {
        set { _current_address = value; }
        get { return _current_address; }
    }
    public string IDCard
    {
        set {  _idcard=value; }
        get { return _idcard; }
    }

    DateTime _dateIssueIDCard;

    public DateTime DateIssueIDCard
    {
        set { _dateIssueIDCard = value; }
        get { return _dateIssueIDCard; }
    }
    string _placeIssueIDCard;
    public string PlaceIssueIDCard
    { 
    
        set{_placeIssueIDCard=value;}
        get{return _placeIssueIDCard;}
    }
    public string Relocate
    {
        set { _relocate = value; }
        get { return _relocate; }
    }
    public string Aptitude
    {
        set { _aptitude = value; }
        get { return _aptitude; }
    
    }
   
    public string _city;
    public string City
    {
        set { _city = value; }
        get { return _city; }
    }

   
    /*-------------------Danh gia---------------*/


    public DateTime _interviewdate;

    public DateTime InterviewDate
    {
        set { _interviewdate = value; }
        get {return _interviewdate; }
    }

    public string _member_interview;
    public string MemberInterView
    {
        set { _member_interview = value; }
        get { return _member_interview; }
    }
  

   
    /*---------------Insert Info --------------*/
   
    private string _profile_type;
    private string _position_apply;
    private DateTime _available_date;
    private long? _expected_salary=null;
    private string _currency_salary;
    public string _carreer_objectives;
    public string CarreerObjectives
    {
        set { _carreer_objectives = value; }
        get { return _carreer_objectives; }
    }


    public ProfileAll Get_Profile(ProfileAll p)
    {
        string strAvailableDate,strBirth;

        ds = SqlHelper.ExecuteDataset(Common.strConnect, "Get_Profile", new object[] { this._id });
        /*
          b.pos,b.availabledate,b.expectedsalary,b.currency_salary,b.carreerobjectives
          ,k.id as [known_from_id] ,k.known_from
	      ,p.profile_id,p.fullname,p.birth, p.sex,p.height,p.weight,p.phone,p.mail,p.married
	      ,p.number_of_childrens,p.married_status_others
	      ,p.id_card,p.dateidcard,p.placeissueidcard
	      ,p.permanent_address
	      ,p.current_address,p.relocate,p.aptitude,p.date_created
	      ,p.image_URL, p.active*/

     
        if (ds.Tables[0].Rows[0]["availabledate"].ToString() != "")
        {
            strAvailableDate=Common.Convert_MMDDYYYY_To_DDMMYYY(ds.Tables[0].Rows[0]["fullname"].ToString());
            _available_date=DateTime.Parse(strAvailableDate);
        }

        if (ds.Tables[0].Rows[0]["expectedsalary"].ToString()!="")
            _expected_salary =Convert.ToUInt32(ds.Tables[0].Rows[0]["expectedsalary"].ToString());

        _currency_salary = ds.Tables[0].Rows[0]["currency_salary"].ToString();
        _carreer_objectives = ds.Tables[0].Rows[0]["carreerobjectives"].ToString();
        _known_us = ds.Tables[0].Rows[0]["known_from"].ToString();
        _fullname = ds.Tables[0].Rows[0]["fullname"].ToString();

        if (ds.Tables[0].Rows[0]["birth"].ToString() != "")
        {
            strBirth = Common.Convert_MMDDYYYY_To_DDMMYYY(ds.Tables[0].Rows[0]["birth"].ToString());
            _birth = DateTime.Parse(strBirth);
        }
        _sex = ds.Tables[0].Rows[0]["sex"].ToString();

        if (ds.Tables[0].Rows[0]["height"].ToString()!="")
            _height =Convert.ToUInt16(ds.Tables[0].Rows[0]["height"].ToString());

        if (ds.Tables[0].Rows[0]["weight"].ToString() != "")
            _weight = Convert.ToUInt16(ds.Tables[0].Rows[0]["weight"].ToString());
        
        _phone = ds.Tables[0].Rows[0]["phone"].ToString();
        _mail = ds.Tables[0].Rows[0]["mail"].ToString();
        _married = ds.Tables[0].Rows[0]["married"].ToString();
        _permanent_address = ds.Tables[0].Rows[0]["permanent_address"].ToString();
        _current_address = ds.Tables[0].Rows[0]["current_address"].ToString();




        return p;
    }
   

}
